{extend name="base"}
{block name="title"}在线用户记录{/block}
{block name="head"}{/block}
{block name="body"}
<body class="mainbody">
<form>
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>在线用户记录</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <div class="menu-list">
          <div class="rule-single-select">
            <select name="channel" style="display:none">
              <option value="-1">===所有渠道===</option>
              {volist name="CHANNELS" id="val"}
              <option value="{$key}"{eq name="channel" value="$key"} selected{/eq}>[{$key}]{$val.Name}</option>
              {/volist}
            </select>
          </div>
          <div class="rule-single-select">
            <select name="server" style="display:none">
              <option value="-1">==ServeID==</option>
              {volist name="SERVERID" id="val"}
              <option value="{$key}"{eq name="server" value="$key"} selected{/eq}>[{$key}]{$val}</option>
              {/volist}
            </select>
          </div>
          <div class="rule-single-select">
            <select name="show" style="display:none">
              {volist name="SHOWS" id="val"}
              <option value="{$key}"{eq name="show" value="$key"} selected{/eq}>[{$key}]{$val}</option>
              {/volist}
            </select>
          </div>
          <input type="text" class="input rule-date-input" autocomplete="off" {literal}onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate:'%y-%M-%d'})"{/literal} name="time1" value="{$time1}" placeholder="收集日期起始" />&nbsp;
          <input type="text" class="input rule-date-input" autocomplete="off" {literal}onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate:'%y-%M-%d'})"{/literal} name="time2" value="{$time2}" placeholder="收集日期截止" />&nbsp;
          <input type="text" class="input txt" autocomplete="off" name="search" value="{$search|default=''|htmlentities}" placeholder="UserID/GameID/昵称" />
          <input type="text" class="input small" autocomplete="off" name="yqcode" value="{$yqcode|default=''|htmlentities}" placeholder="邀请码" />
          <a class="btn-search"><i class="iconfont icon-search"></i></a>
          <a target="_blank" class="btn yellow" href="{:url('user.online/trend')}">在线统计</a>
        </div>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
<table class="ltable border-table">
  <tr>
    <th>渠道</th>
    <th>游戏IP/所在游戏</th>
    <th>所在桌子</th>
    <th>用户头像/昵称/GameID/收集日期</th>
    <th>推广员</th>
    <th>房卡/金币</th>
    <th>游戏次数</th>
  {for start="6" end="0" comparison="EGT" step="-1"}
    <th>{:date('m-d', $time7 - $i * 24 * 60 * 60)}</th>
  {/for}
    <th>七日输赢</th>
    <th>累计输赢</th>
    <th>操作</th>
  </tr>
{empty name="list"}
  <tr><td colspan="17">Oh~暂无数据!</td></tr>
{else}
  {volist name="list" id="v"}
  <tr data-GameID="{$v.GameID}">
    <td title="{$v.Channel}">{$CHANNELS[$v.Channel]['Name'] ?? '--'}</td>
    <td>[{$v.ServerID}]{$v.ServerName}<br/>[{$v.KindID}]{$v.GameName}</td>
    <td>{$v.TableNum}</td>
    <td class="user-avatar" title="
游戏帐号：{$v.Accounts}&#13
真实姓名：{$v.Compellation}&#13
用户标识：{$v.UserID}&#13
手机号码：{$v.MobilePhone}&#13
    性别：{switch name='$v.Sex'}{case value='0'}未知{/case}{case value='1'}男性{/case}{case value='2'}女性{/case}{/switch}&#13
注册时间：{$v.RegisterDate}&#13
注册地址：{$v.RegisterIP}&#13;
登录次数：{$v.GameLogonCount} 次&#13
最后登录时间：{$v.LastLogonDate}&#13
最后登录地址：{$v.LastLogonIP}&#13
">
      <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.UserID}">
        <img src="{$v.Avatar?:'__STATIC__/houtai/images/dface.png'}" />
      </a>
      <div class="user-box">
        <h4><a target="_blank" class="at_{$v.AccountsType}" href="{:url('user.detail/index')}?UserID={$v.UserID}">{:htmlentities($v.NickName)}[{$v.GameID}]</a></h4>
        <i>{$v.CreateDate}</i>
      </div>
    </td>
    <td class="user-avatar">
      <a target="_blank" href="{:url('user.detail/index')}?UserID={$v.AUserID}">
        <img src="{$v.AAvatar?:'__STATIC__/houtai/images/dface.png'}" />
      </a>
      <div class="user-box">
        <h4><a target="_blank" class="at_{$v.AAccountsType}" href="{:url('user.detail/index')}?UserID={$v.AUserID}">{:htmlentities($v.ACompellation)}</a></h4>
        <i>{$v.AGameID}</i>
      </div>
    </td>
    <td class="m_{$v.ServerType}"><a target="_blank" href="{:url('user.room.card/index')}?search={$v.GameID}">{$v.Money}</a></td>
    <td><a target="_blank" href="{:url('user.table/index')}?type=4&search={$v.GameID}">{$v.PlayCount}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz6'] > 0 : $v['dayl6'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-6*60*60*24)}&time2={:date('Y-m-d', $time7-6*60*60*24)}">{in name="show" value="0,1"}{$v.dayl6}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz6|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz5'] > 0 : $v['dayl5'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-5*60*60*24)}&time2={:date('Y-m-d', $time7-5*60*60*24)}">{in name="show" value="0,1"}{$v.dayl5}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz5|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz4'] > 0 : $v['dayl4'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-4*60*60*24)}&time2={:date('Y-m-d', $time7-4*60*60*24)}">{in name="show" value="0,1"}{$v.dayl4}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz4|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz3'] > 0 : $v['dayl3'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-3*60*60*24)}&time2={:date('Y-m-d', $time7-3*60*60*24)}">{in name="show" value="0,1"}{$v.dayl3}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz3|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz2'] > 0 : $v['dayl2'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-2*60*60*24)}&time2={:date('Y-m-d', $time7-2*60*60*24)}">{in name="show" value="0,1"}{$v.dayl2}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz2|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz1'] > 0 : $v['dayl1'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-1*60*60*24)}&time2={:date('Y-m-d', $time7-1*60*60*24)}">{in name="show" value="0,1"}{$v.dayl1}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz1|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz0'] > 0 : $v['dayl0'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-0*60*60*24)}&time2={:date('Y-m-d', $time7-0*60*60*24)}">{in name="show" value="0,1"}{$v.dayl0}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz0|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayz7'] > 0 : $v['dayl7'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}&time1={:date('Y-m-d', $time7-6*60*60*24)}&time2={:date('Y-m-d', $time7-0*60*60*24)}">{in name="show" value="0,1"}{$v.dayl7}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayz7|round}{/in}</a></td>
    <td class="tr<?php if ($show == 2 ? $v['dayzs'] > 0 : $v['dayls'] > 0): ?> red<?php endif; ?>"><a target="_blank" href="{$URL_GAME_INDEX}?search={$v.GameID}">{in name="show" value="0,1"}{$v.dayls}{/in}{eq name="show" value="0"}<br/>{/eq}{in name="show" value="0,2"}${$v.dayzs|round}{/in}</a></td>
    <td><a class="input a">redis</a></br><a class="input b">清理</a></td>
  </tr>
  {/volist}
{/empty}
</table>
</div>
<!--/列表-->

<!--内容底部-->
<div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>
<!--/内容底部-->

</form>
<script>
$(function () {
  $.UserControl.init({
    URL_DETAIL: "{:url('user.redis.control/detail')}",
    URL_DELONE: "{:url('user.redis.control/delone')}",
    URL_DELALL: "{:url('user.redis.control/delall')}",
    URL_DELLOG: "{:url('user.redis.control/dellog')}",
  });
  $('table.ltable td:last-child a.a').click(function () {
    var GameID = $(this).parents('tr').attr('data-GameID');
    $.UserControl.ShowDetailDialog(GameID);
  });
  $('table.ltable td:last-child a.b').click(function () {
    var GameID = $(this).parents('tr').attr('data-GameID');
    dialog({
      title: '提示',
      content: '确定清理?GameID=' + GameID,
      width: 200,
      height: 30,
      okValue: '确认',
      ok: function () {
        var url = "{:url('clear')}?GameID=" + GameID;
        $.post(url, function (resp, state, xhr) {
          console.log(resp);
          alert(resp.error);
          if (resp.errno == 0) {
            location.reload();
          }
        });
        return false;
      }
    }).showModal();
  });
});
</script>
</body>
{/block}